package com.rmt.www.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.rmt.www.constant.ArtifactType;
import com.rmt.www.dao.ArtifactDao;
import com.rmt.www.dao.ProjectDao;
import com.rmt.www.dao.UserDao;
import com.rmt.www.service.AdminManageDetailService;
import com.rmt.www.service.ArtifactDetailQueryService;
import com.rmt.www.vo.Artifact;
import com.rmt.www.vo.DesignArtifact;
import com.rmt.www.vo.FeatureArtifact;
import com.rmt.www.vo.ImplementationArtifact;
import com.rmt.www.vo.Project;
import com.rmt.www.vo.RequirementArtifact;
import com.rmt.www.vo.TestArtifact;
import com.rmt.www.vo.User;


public class DetailAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int pid;
	private List<FeatureArtifact> featureList;
	private List<RequirementArtifact> requirementList;
	private List<DesignArtifact> designList;
	private List<ImplementationArtifact> implementationList;
	private List<TestArtifact> testcaseList;
	private User u;
	private AdminManageDetailService adminManageDetailService;
	private ArtifactDetailQueryService artifactDetailQueryService;
	public ArtifactDetailQueryService getArtifactDetailQueryService() {
		return artifactDetailQueryService;
	}

	public void setArtifactDetailQueryService(
			ArtifactDetailQueryService artifactDetailQueryService) {
		this.artifactDetailQueryService = artifactDetailQueryService;
	}

	public AdminManageDetailService getAdminManageDetailService() {
		return adminManageDetailService;
	}

	public void setAdminManageDetailService(
			AdminManageDetailService adminManageDetailService) {
		this.adminManageDetailService = adminManageDetailService;
	}

	public User getU() {
		return u;
	}

	public void setU(User u) {
		this.u = u;
	}

	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		System.out.println("DetailAction.setPid() "+pid);
		this.pid = pid;
	}
	
	public String execute(){
		
		featureList = artifactDetailQueryService.getFeatureList(pid);
		requirementList = artifactDetailQueryService.getRequirementList(pid);
		designList = artifactDetailQueryService.getDesignList(pid);
		implementationList = artifactDetailQueryService.getImplementationList(pid);
		testcaseList = artifactDetailQueryService.getTestCaseList(pid);
		
		u=(User) ActionContext.getContext().getSession().get("currentUser");
		String type=u.getType();
		return type;
	}

	public List<FeatureArtifact> getFeatureList() {
		return featureList;
	}

	public void setFeatureList(List<FeatureArtifact> featureList) {
		this.featureList = featureList;
	}

	public List<RequirementArtifact> getRequirementList() {
		return requirementList;
	}

	public void setRequirementList(List<RequirementArtifact> requirementList) {
		this.requirementList = requirementList;
	}

	public List<DesignArtifact> getDesignList() {
		return designList;
	}

	public void setDesignList(List<DesignArtifact> designList) {
		this.designList = designList;
	}

	public List<ImplementationArtifact> getImplementationList() {
		return implementationList;
	}

	public void setImplementationList(
			List<ImplementationArtifact> implementationList) {
		this.implementationList = implementationList;
	}

	public List<TestArtifact> getTestcaseList() {
		return testcaseList;
	}

	public void setTestcaseList(List<TestArtifact> testcaseList) {
		this.testcaseList = testcaseList;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
